home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / fp.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  36.6 KB  |  1,404 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        fp.a
  3. ;
  4. ;    Contains:    FPCE Floating-Point Definitions and Declarations.
  5. ;
  6. ;    Version:    Technology:    MathLib v2
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__FP__') = 'UNDEFINED' THEN
  18. __FP__ SET 1
  19.  
  20.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  21.     include 'ConditionalMacros.a'
  22.     ENDIF
  23.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  24.     include 'MacTypes.a'
  25.     ENDIF
  26.  
  27. ; ********************************************************************************
  28. ;*                                                                               *
  29. ;*    A collection of numerical functions designed to facilitate a wide          *
  30. ;*    range of numerical programming as required by C9X.                         *
  31. ;*                                                                               *
  32. ;*    The <fp.h> declares many functions in support of numerical programming.    *
  33. ;*    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
  34. ;*    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
  35. ;*    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
  36. ;*                                                                               *
  37. ;*    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
  38. ;*    positive and negative zero and infinity consistent with the floating-      *
  39. ;*    point standard.                                                            *
  40. ;*                                                                               *
  41. ;*******************************************************************************
  42.  
  43.  
  44. ; ********************************************************************************
  45. ;*                                                                               *
  46. ;*                            Efficient types                                    *
  47. ;*                                                                               *
  48. ;*    float_t         Most efficient type at least as wide as float              *
  49. ;*    double_t        Most efficient type at least as wide as double             *
  50. ;*                                                                               *
  51. ;*      CPU            float_t(bits)                double_t(bits)               *
  52. ;*    --------        -----------------            -----------------             *
  53. ;*    PowerPC          float(32)                    double(64)                   *
  54. ;*    68K              long double(80/96)           long double(80/96)           *
  55. ;*    x86              long double(80)              long double(80)              *
  56. ;*                                                                               *
  57. ;*******************************************************************************
  58.  
  59.     IF TARGET_CPU_PPC THEN
  60. ; typedef float                         float_t
  61.  
  62. ; typedef double                         double_t
  63.  
  64.     ELSEIF TARGET_CPU_68K THEN
  65. ; typedef long double                     float_t
  66.  
  67. ; typedef long double                     double_t
  68.  
  69.     ELSEIF TARGET_CPU_X86 THEN
  70.     IF NeXT THEN
  71. ; typedef double                         float_t
  72.  
  73. ; typedef double                         double_t
  74.  
  75.     ELSE
  76. ; typedef long double                     float_t
  77.  
  78. ; typedef long double                     double_t
  79.  
  80.     ENDIF    ; NeXT
  81.     ELSEIF TARGET_CPU_MIPS THEN
  82. ; typedef double                         float_t
  83.  
  84. ; typedef double                         double_t
  85.  
  86.     ELSEIF TARGET_CPU_ALPHA THEN
  87. ; typedef double                         float_t
  88.  
  89. ; typedef double                         double_t
  90.  
  91.     ELSEIF TARGET_CPU_SPARC THEN
  92. ; typedef double                         float_t
  93.  
  94. ; typedef double                         double_t
  95.  
  96.     ELSE
  97.     ENDIF    ; 
  98.  
  99. ; ********************************************************************************
  100. ;*                                                                               *
  101. ;*                              Define some constants.                           *
  102. ;*                                                                               *
  103. ;*    HUGE_VAL            IEEE 754 value of infinity.                            *
  104. ;*    INFINITY            IEEE 754 value of infinity.                            *
  105. ;*    NAN                 A generic NaN (Not A Number).                          *
  106. ;*    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
  107. ;*                        double to decimal and back is the identity function.   *
  108. ;*                                                                               *
  109. ;*******************************************************************************
  110.  
  111.     IF TARGET_OS_MAC THEN
  112. ; ********************************************************************************
  113. ;*                                                                               *
  114. ;*                            Trigonometric functions                            *
  115. ;*                                                                               *
  116. ;*   acos        result is in [0,pi].                                            *
  117. ;*   asin        result is in [-pi/2,pi/2].                                      *
  118. ;*   atan        result is in [-pi/2,pi/2].                                      *
  119. ;*   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
  120. ;*               both arguments to determine the quadrant of the computed value. *
  121. ;*                                                                               *
  122. ;*******************************************************************************
  123.  
  124. ;
  125. ; extern double_t cos(double_t x)
  126. ;
  127.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  128.         IMPORT_CFM_FUNCTION cos
  129.     ENDIF
  130.  
  131. ;
  132. ; extern double_t sin(double_t x)
  133. ;
  134.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION sin
  136.     ENDIF
  137.  
  138. ;
  139. ; extern double_t tan(double_t x)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  142.         IMPORT_CFM_FUNCTION tan
  143.     ENDIF
  144.  
  145. ;
  146. ; extern double_t acos(double_t x)
  147. ;
  148.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  149.         IMPORT_CFM_FUNCTION acos
  150.     ENDIF
  151.  
  152. ;
  153. ; extern double_t asin(double_t x)
  154. ;
  155.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  156.         IMPORT_CFM_FUNCTION asin
  157.     ENDIF
  158.  
  159. ;
  160. ; extern double_t atan(double_t x)
  161. ;
  162.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  163.         IMPORT_CFM_FUNCTION atan
  164.     ENDIF
  165.  
  166. ;
  167. ; extern double_t atan2(double_t y, double_t x)
  168. ;
  169.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  170.         IMPORT_CFM_FUNCTION atan2
  171.     ENDIF
  172.  
  173.  
  174.  
  175. ; ********************************************************************************
  176. ;*                                                                                *
  177. ;*                              Hyperbolic functions                             *
  178. ;*                                                                                *
  179. ;*******************************************************************************
  180.  
  181. ;
  182. ; extern double_t cosh(double_t x)
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION cosh
  186.     ENDIF
  187.  
  188. ;
  189. ; extern double_t sinh(double_t x)
  190. ;
  191.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION sinh
  193.     ENDIF
  194.  
  195. ;
  196. ; extern double_t tanh(double_t x)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  199.         IMPORT_CFM_FUNCTION tanh
  200.     ENDIF
  201.  
  202. ;
  203. ; extern double_t acosh(double_t x)
  204. ;
  205.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  206.         IMPORT_CFM_FUNCTION acosh
  207.     ENDIF
  208.  
  209. ;
  210. ; extern double_t asinh(double_t x)
  211. ;
  212.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  213.         IMPORT_CFM_FUNCTION asinh
  214.     ENDIF
  215.  
  216. ;
  217. ; extern double_t atanh(double_t x)
  218. ;
  219.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  220.         IMPORT_CFM_FUNCTION atanh
  221.     ENDIF
  222.  
  223.  
  224.  
  225. ; ********************************************************************************
  226. ;*                                                                                *
  227. ;*                              Exponential functions                               *
  228. ;*                                                                                *
  229. ;*    expm1        expm1(x) = exp(x) - 1.  But, for small enough arguments,          *
  230. ;*                expm1(x) is expected to be more accurate than exp(x) - 1.        *
  231. ;*    frexp        Breaks a floating-point number into a normalized fraction       *
  232. ;*                and an integral power of 2.  It stores the integer in the       *
  233. ;*                object pointed by *exponent.                                    *
  234. ;*    ldexp        Multiplies a floating-point    number by an integer power of 2.    *
  235. ;*    log1p        log1p = log(1 + x). But, for small enough arguments,              *
  236. ;*                 log1p is expected to be more accurate than log(1 + x).          *
  237. ;*    logb        Extracts the exponent of its argument, as a signed integral        *
  238. ;*                  value. A subnormal argument is treated as though it were first    *
  239. ;*                  normalized. Thus:                                                *
  240. ;*                                     1   <=   x * 2^(-logb(x))   <   2             *
  241. ;*    modf        Returns fractional part of x as function result and returns     *
  242. ;*                integral part of x via iptr. Note C9X uses double not double_t.    *
  243. ;*    scalb        Computes x * 2^n efficently.  This is not normally done by        *
  244. ;*                  computing 2^n explicitly.                                         *
  245. ;*                                                                                *
  246. ;*******************************************************************************
  247.  
  248. ;
  249. ; extern double_t exp(double_t x)
  250. ;
  251.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  252.         IMPORT_CFM_FUNCTION exp
  253.     ENDIF
  254.  
  255. ;
  256. ; extern double_t expm1(double_t x)
  257. ;
  258.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  259.         IMPORT_CFM_FUNCTION expm1
  260.     ENDIF
  261.  
  262. ;
  263. ; extern double_t exp2(double_t x)
  264. ;
  265.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  266.         IMPORT_CFM_FUNCTION exp2
  267.     ENDIF
  268.  
  269. ;
  270. ; extern double_t frexp(double_t x, int *exponent)
  271. ;
  272.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  273.         IMPORT_CFM_FUNCTION frexp
  274.     ENDIF
  275.  
  276. ;
  277. ; extern double_t ldexp(double_t x, int n)
  278. ;
  279.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  280.         IMPORT_CFM_FUNCTION ldexp
  281.     ENDIF
  282.  
  283. ;
  284. ; extern double_t log(double_t x)
  285. ;
  286.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  287.         IMPORT_CFM_FUNCTION log
  288.     ENDIF
  289.  
  290. ;
  291. ; extern double_t log2(double_t x)
  292. ;
  293.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  294.         IMPORT_CFM_FUNCTION log2
  295.     ENDIF
  296.  
  297. ;
  298. ; extern double_t log1p(double_t x)
  299. ;
  300.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  301.         IMPORT_CFM_FUNCTION log1p
  302.     ENDIF
  303.  
  304. ;
  305. ; extern double_t log10(double_t x)
  306. ;
  307.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  308.         IMPORT_CFM_FUNCTION log10
  309.     ENDIF
  310.  
  311. ;
  312. ; extern double_t logb(double_t x)
  313. ;
  314.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  315.         IMPORT_CFM_FUNCTION logb
  316.     ENDIF
  317.  
  318. ;
  319. ; extern double_t modf(double_t x, double_t *iptr)
  320. ;
  321.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  322.         IMPORT_CFM_FUNCTION modf
  323.     ENDIF
  324.  
  325. ;
  326. ; extern float modff(float x, float *iptrf)
  327. ;
  328.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  329.         IMPORT_CFM_FUNCTION modff
  330.     ENDIF
  331.  
  332. ;
  333. ; extern double_t scalb(double_t x, long n)
  334. ;
  335.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  336.         IMPORT_CFM_FUNCTION scalb
  337.     ENDIF
  338.  
  339.  
  340.  
  341. ; ********************************************************************************
  342. ;*                                                                                *
  343. ;*                     Power and absolute value functions                          *
  344. ;*                                                                                *
  345. ;*    hypot        Computes the square root of the sum of the squares of its        *
  346. ;*                  arguments, without undue overflow or underflow.                 *
  347. ;*    pow            Returns x raised to the power of y.  Result is more accurate    *
  348. ;*                than using exp(log(x)*y).                                        *
  349. ;*                                                                                *
  350. ;*******************************************************************************
  351.  
  352. ;
  353. ; extern double_t fabs(double_t x)
  354. ;
  355.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  356.         IMPORT_CFM_FUNCTION fabs
  357.     ENDIF
  358.  
  359. ;
  360. ; extern double_t hypot(double_t x, double_t y)
  361. ;
  362.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  363.         IMPORT_CFM_FUNCTION hypot
  364.     ENDIF
  365.  
  366. ;
  367. ; extern double_t pow(double_t x, double_t y)
  368. ;
  369.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  370.         IMPORT_CFM_FUNCTION pow
  371.     ENDIF
  372.  
  373. ;
  374. ; extern double_t sqrt(double_t x)
  375. ;
  376.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  377.         IMPORT_CFM_FUNCTION sqrt
  378.     ENDIF
  379.  
  380.  
  381.  
  382. ; ********************************************************************************
  383. ;*                                                                                 *
  384. ;*                        Gamma and Error functions                               *
  385. ;*                                                                                 *
  386. ;*     erf            The error function.                                             *
  387. ;*     erfc        Complementary error function.                                      *
  388. ;*     gamma        The gamma function.                                                *
  389. ;*     lgamma        Computes the base-e logarithm of the absolute value of            *
  390. ;*                 gamma of its argument x, for x > 0.                                *
  391. ;*                                                                                 *
  392. ;*******************************************************************************
  393.  
  394. ;
  395. ; extern double_t erf(double_t x)
  396. ;
  397.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  398.         IMPORT_CFM_FUNCTION erf
  399.     ENDIF
  400.  
  401. ;
  402. ; extern double_t erfc(double_t x)
  403. ;
  404.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  405.         IMPORT_CFM_FUNCTION erfc
  406.     ENDIF
  407.  
  408. ;
  409. ; extern double_t gamma(double_t x)
  410. ;
  411.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  412.         IMPORT_CFM_FUNCTION gamma
  413.     ENDIF
  414.  
  415. ;
  416. ; extern double_t lgamma(double_t x)
  417. ;
  418.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  419.         IMPORT_CFM_FUNCTION lgamma
  420.     ENDIF
  421.  
  422.  
  423.  
  424. ; ********************************************************************************
  425. ;*                                                                                 *
  426. ;*                        Nearest integer functions                                 *
  427. ;*                                                                                 *
  428. ;*     rint        Rounds its argument to an integral value in floating point         *
  429. ;*                  format, honoring the current rounding direction.                   *
  430. ;*                                                                                 *
  431. ;*     nearbyint    Differs from rint only in that it does not raise the inexact    *
  432. ;*               exception. It is the nearbyint function recommended by the        *
  433. ;*                  IEEE floating-point standard 854.                                  *
  434. ;*                                                                                 *
  435. ;*     rinttol        Rounds its argument to the nearest long int using the current     *
  436. ;*                  rounding direction.  NOTE: if the rounded value is outside        *
  437. ;*                the range of long int, then the result is undefined.              *
  438. ;*                                                                                  *
  439. ;*     round        Rounds the argument to the nearest integral value in floating     *
  440. ;*                  point format similar to the Fortran "anint" function. That is:  *
  441. ;*                  add half to the magnitude and chop.                             *
  442. ;*                                                                                 *
  443. ;*     roundtol    Similar to the Fortran function nint or to the Pascal round.    *
  444. ;*                 NOTE: if the rounded value is outside the range of long int,    *
  445. ;*                  then the result is undefined.                                      *
  446. ;*                                                                                 *
  447. ;*     trunc        Computes the integral value, in floating format, nearest to        *
  448. ;*                 but no larger in magnitude than its argument.      NOTE: on 68K    *
  449. ;*                compilers when using -elems881, trunc must return an int        *
  450. ;*                                                                                 *
  451. ;*******************************************************************************
  452.  
  453. ;
  454. ; extern double_t ceil(double_t x)
  455. ;
  456.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  457.         IMPORT_CFM_FUNCTION ceil
  458.     ENDIF
  459.  
  460. ;
  461. ; extern double_t floor(double_t x)
  462. ;
  463.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  464.         IMPORT_CFM_FUNCTION floor
  465.     ENDIF
  466.  
  467. ;
  468. ; extern double_t rint(double_t x)
  469. ;
  470.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  471.         IMPORT_CFM_FUNCTION rint
  472.     ENDIF
  473.  
  474. ;
  475. ; extern double_t nearbyint(double_t x)
  476. ;
  477.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  478.         IMPORT_CFM_FUNCTION nearbyint
  479.     ENDIF
  480.  
  481. ;
  482. ; extern long rinttol(double_t x)
  483. ;
  484.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  485.         IMPORT_CFM_FUNCTION rinttol
  486.     ENDIF
  487.  
  488. ;
  489. ; extern double_t round(double_t x)
  490. ;
  491.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  492.         IMPORT_CFM_FUNCTION round
  493.     ENDIF
  494.  
  495. ;
  496. ; extern long roundtol(double_t round)
  497. ;
  498.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  499.         IMPORT_CFM_FUNCTION roundtol
  500.     ENDIF
  501.  
  502.     IF TARGET_CPU_68K THEN
  503. ;
  504. ; extern int trunc(double_t x)
  505. ;
  506.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  507.         IMPORT_CFM_FUNCTION trunc
  508.     ENDIF
  509.  
  510.     ELSE
  511. ;
  512. ; extern double_t trunc(double_t x)
  513. ;
  514.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  515.         IMPORT_CFM_FUNCTION trunc
  516.     ENDIF
  517.  
  518.     ENDIF    ; TARGET_CPU_68K
  519.  
  520. ; ********************************************************************************
  521. ;*                                                                                 *
  522. ;*                            Remainder functions                                   *
  523. ;*                                                                                 *
  524. ;*     remainder        IEEE 754 floating point standard for remainder.                *
  525. ;*     remquo            SANE remainder.  It stores into 'quotient' the 7 low-order    *
  526. ;*                    bits of the integer quotient x/y, such that:                *
  527. ;*                        -127 <= quotient <= 127.                                 *
  528. ;*                                                                                 *
  529. ;*******************************************************************************
  530.  
  531. ;
  532. ; extern double_t fmod(double_t x, double_t y)
  533. ;
  534.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  535.         IMPORT_CFM_FUNCTION fmod
  536.     ENDIF
  537.  
  538. ;
  539. ; extern double_t remainder(double_t x, double_t y)
  540. ;
  541.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  542.         IMPORT_CFM_FUNCTION remainder
  543.     ENDIF
  544.  
  545. ;
  546. ; extern double_t remquo(double_t x, double_t y, int *quo)
  547. ;
  548.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  549.         IMPORT_CFM_FUNCTION remquo
  550.     ENDIF
  551.  
  552.  
  553.  
  554. ; ********************************************************************************
  555. ;*                                                                                 *
  556. ;*                             Auxiliary functions                               *
  557. ;*                                                                                 *
  558. ;*     copysign        Produces a value with the magnitude of its first argument    *
  559. ;*                      and sign of its second argument.  NOTE: the order of the     *
  560. ;*                      arguments matches the recommendation of the IEEE 754         *
  561. ;*                    floating point standard,  which is opposite from the SANE    *
  562. ;*                    copysign function.                                             *
  563. ;*                                                                                 *
  564. ;*     nan                The call 'nan("n-char-sequence")' returns a quiet NaN         *
  565. ;*                      with content indicated through tagp in the selected         *
  566. ;*                    data type format.                                              *
  567. ;*                                                                                *
  568. ;*     nextafter        Computes the next representable value after 'x' in the         *
  569. ;*                    direction of 'y'.  if x == y, then y is returned.            *
  570. ;*                                                                                 *
  571. ;*******************************************************************************
  572.  
  573. ;
  574. ; extern double_t copysign(double_t x, double_t y)
  575. ;
  576.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  577.         IMPORT_CFM_FUNCTION copysign
  578.     ENDIF
  579.  
  580. ;
  581. ; extern double nan(const char *tagp)
  582. ;
  583.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  584.         IMPORT_CFM_FUNCTION nan
  585.     ENDIF
  586.  
  587. ;
  588. ; extern float nanf(const char *tagp)
  589. ;
  590.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  591.         IMPORT_CFM_FUNCTION nanf
  592.     ENDIF
  593.  
  594. ;
  595. ; extern double nextafterd(double x, double y)
  596. ;
  597.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  598.         IMPORT_CFM_FUNCTION nextafterd
  599.     ENDIF
  600.  
  601. ;
  602. ; extern float nextafterf(float x, float y)
  603. ;
  604.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  605.         IMPORT_CFM_FUNCTION nextafterf
  606.     ENDIF
  607.  
  608.  
  609.  
  610. ; ********************************************************************************
  611. ;*                                                                                 *
  612. ;*                              Inquiry macros                                   *
  613. ;*                                                                                 *
  614. ;*     fpclassify        Returns one of the FP_≈ values.                                *
  615. ;*     isnormal        Non-zero if and only if the argument x is normalized.          *
  616. ;*     isfinite        Non-zero if and only if the argument x is finite.             *
  617. ;*     isnan            Non-zero if and only if the argument x is a NaN.              *
  618. ;*     signbit            Non-zero if and only if the sign of the argument x is        *
  619. ;*                      negative.  This includes, NaNs, infinities and zeros.         *
  620. ;*                                                                                 *
  621. ;*******************************************************************************
  622.  
  623.  
  624. FP_SNAN                            EQU        0                    ;      signaling NaN                         
  625. FP_QNAN                            EQU        1                    ;      quiet NaN                             
  626. FP_INFINITE                        EQU        2                    ;      + or - infinity                       
  627. FP_ZERO                            EQU        3                    ;      + or - zero                           
  628. FP_NORMAL                        EQU        4                    ;      all normal numbers                    
  629. FP_SUBNORMAL                    EQU        5                    ;      denormal numbers                      
  630.  
  631.  
  632. ;
  633. ; extern long __fpclassifyd(double x)
  634. ;
  635.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  636.         IMPORT_CFM_FUNCTION __fpclassifyd
  637.     ENDIF
  638.  
  639. ;
  640. ; extern long __fpclassifyf(float x)
  641. ;
  642.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  643.         IMPORT_CFM_FUNCTION __fpclassifyf
  644.     ENDIF
  645.  
  646. ;
  647. ; extern long __isnormald(double x)
  648. ;
  649.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  650.         IMPORT_CFM_FUNCTION __isnormald
  651.     ENDIF
  652.  
  653. ;
  654. ; extern long __isnormalf(float x)
  655. ;
  656.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  657.         IMPORT_CFM_FUNCTION __isnormalf
  658.     ENDIF
  659.  
  660. ;
  661. ; extern long __isfinited(double x)
  662. ;
  663.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  664.         IMPORT_CFM_FUNCTION __isfinited
  665.     ENDIF
  666.  
  667. ;
  668. ; extern long __isfinitef(float x)
  669. ;
  670.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  671.         IMPORT_CFM_FUNCTION __isfinitef
  672.     ENDIF
  673.  
  674. ;
  675. ; extern long __isnand(double x)
  676. ;
  677.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  678.         IMPORT_CFM_FUNCTION __isnand
  679.     ENDIF
  680.  
  681. ;
  682. ; extern long __isnanf(float x)
  683. ;
  684.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  685.         IMPORT_CFM_FUNCTION __isnanf
  686.     ENDIF
  687.  
  688. ;
  689. ; extern long __signbitd(double x)
  690. ;
  691.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  692.         IMPORT_CFM_FUNCTION __signbitd
  693.     ENDIF
  694.  
  695. ;
  696. ; extern long __signbitf(float x)
  697. ;
  698.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  699.         IMPORT_CFM_FUNCTION __signbitf
  700.     ENDIF
  701.  
  702. ;
  703. ; extern double_t __inf(void )
  704. ;
  705.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  706.         IMPORT_CFM_FUNCTION __inf
  707.     ENDIF
  708.  
  709.  
  710.  
  711. ; ********************************************************************************
  712. ;*                                                                                 *
  713. ;*                      Max, Min and Positive Difference                         *
  714. ;*                                                                                 *
  715. ;*     fdim        Determines the 'positive difference' between its arguments:     *
  716. ;*                { x - y, if x > y }, { +0, if x <= y }.  If one argument is        *
  717. ;*                  NaN, then fdim returns that NaN.  if both arguments are NaNs,     *
  718. ;*                 then fdim returns the first argument.                            *
  719. ;*                                                                                 *
  720. ;*     fmax        Returns the maximum of the two arguments.  Corresponds to the    *
  721. ;*                max function in FORTRAN.  NaN arguments are treated as missing     *
  722. ;*                data.  If one argument is NaN and the other is a number, then     *
  723. ;*                the number is returned.  If both are NaNs then the first         *
  724. ;*                argument is returned.                                             *
  725. ;*                                                                                 *
  726. ;*     fmin        Returns the minimum of the two arguments.  Corresponds to the    *
  727. ;*                min function in FORTRAN.  NaN arguments are treated as missing     *
  728. ;*                data.  If one argument is NaN and the other is a number, then     *
  729. ;*                the number is returned.  If both are NaNs then the first         *
  730. ;*                argument is returned.                                            *
  731. ;*                                                                                 *
  732. ;*******************************************************************************
  733.  
  734. ;
  735. ; extern double_t fdim(double_t x, double_t y)
  736. ;
  737.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  738.         IMPORT_CFM_FUNCTION fdim
  739.     ENDIF
  740.  
  741. ;
  742. ; extern double_t fmax(double_t x, double_t y)
  743. ;
  744.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  745.         IMPORT_CFM_FUNCTION fmax
  746.     ENDIF
  747.  
  748. ;
  749. ; extern double_t fmin(double_t x, double_t y)
  750. ;
  751.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  752.         IMPORT_CFM_FUNCTION fmin
  753.     ENDIF
  754.  
  755.  
  756.  
  757. ; *******************************************************************************
  758. ;*                                Constants                                     *
  759. ;******************************************************************************
  760.  
  761.  
  762.  
  763. ; ********************************************************************************
  764. ;*                                                                                 *
  765. ;*                              Non NCEG extensions                                *
  766. ;*                                                                                 *
  767. ;*******************************************************************************
  768.  
  769.     IF &TYPE('__NOEXTENSIONS__') = 'UNDEFINED' THEN
  770. ; ********************************************************************************
  771. ;*                                                                                 *
  772. ;*                              Financial functions                              *
  773. ;*                                                                                 *
  774. ;*     compound        Computes the compound interest factor "(1 + rate)^periods"    *
  775. ;*                      more accurately than the straightforward computation with     *
  776. ;*                    the Power function.  This is SANE's compound function.      *
  777. ;*                                                                                 *
  778. ;*     annuity            Computes the present value factor for an annuity             *
  779. ;*                      "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
  780. ;*                    the straightforward computation with the Power function.     *
  781. ;*                    This is SANE's annuity function.                              *
  782. ;*                                                                                 *
  783. ;*******************************************************************************
  784.  
  785. ;
  786. ; extern double_t compound(double_t rate, double_t periods)
  787. ;
  788.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  789.         IMPORT_CFM_FUNCTION compound
  790.     ENDIF
  791.  
  792. ;
  793. ; extern double_t annuity(double_t rate, double_t periods)
  794. ;
  795.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  796.         IMPORT_CFM_FUNCTION annuity
  797.     ENDIF
  798.  
  799.  
  800.  
  801. ; ********************************************************************************
  802. ;*                                                                                 *
  803. ;*                              Random function                                  *
  804. ;*                                                                                 *
  805. ;*     randomx            A pseudorandom number generator.  It uses the iteration:    *
  806. ;*                                (7^5*x)mod(2^31-1)                                *
  807. ;*                                                                                 *
  808. ;*******************************************************************************
  809.  
  810. ;
  811. ; extern double_t randomx(double_t *x)
  812. ;
  813.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  814.         IMPORT_CFM_FUNCTION randomx
  815.     ENDIF
  816.  
  817.  
  818.  
  819. ; *******************************************************************************
  820. ;*                              Relational operator                             *
  821. ;******************************************************************************
  822.  
  823. ;       relational operator      
  824. ; typedef short                         relop
  825.  
  826.  
  827. GREATERTHAN                        EQU        0
  828. LESSTHAN                        EQU        1
  829. EQUALTO                            EQU        2
  830. UNORDERED                        EQU        3
  831. ;
  832. ; extern relop relation(double_t x, double_t y)
  833. ;
  834.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  835.         IMPORT_CFM_FUNCTION relation
  836.     ENDIF
  837.  
  838.  
  839.  
  840. ; ********************************************************************************
  841. ;*                                                                                 *
  842. ;*                         Binary to decimal conversions                         *
  843. ;*                                                                                 *
  844. ;*     SIGDIGLEN    Significant decimal digits.                                        *
  845. ;*                                                                                 *
  846. ;*     decimal        A record which provides an intermediate unpacked form for        *
  847. ;*                programmers who wish to do their own parsing of numeric input     *
  848. ;*                or formatting of numeric output.                                  *
  849. ;*                                                                                 *
  850. ;*     decform        Controls each conversion to a decimal string.  The style field     *
  851. ;*                is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the     *
  852. ;*                value of the field digits is the number of significant digits.  *
  853. ;*                  If FIXEDDECIMAL value of the field digits is the number of        *
  854. ;*                digits to the right of the decimal point.                         *
  855. ;*                                                                                 *
  856. ;*     num2dec        Converts a double_t to a decimal record    using a decform.        *
  857. ;*     dec2num        Converts a decimal record d to a double_t value.                *
  858. ;*     dec2str        Converts a decform and decimal to a string using a decform.        *
  859. ;*     str2dec        Converts a string to a decimal struct.                            *
  860. ;*     dec2d        Similar to dec2num except a double is returned (68k only).        *
  861. ;*     dec2f        Similar to dec2num except a float is returned.                    *
  862. ;*     dec2s        Similar to dec2num except a short is returned.                    *
  863. ;*     dec2l        Similar to dec2num except a long is returned.                     *
  864. ;*                                                                                 *
  865. ;*******************************************************************************
  866.  
  867.     IF TARGET_CPU_PPC THEN
  868.  
  869. SIGDIGLEN                        EQU        36
  870.     ELSE
  871.  
  872. SIGDIGLEN                        EQU        20
  873.     ENDIF    ; TARGET_CPU_PPC
  874.  
  875. DECSTROUTLEN                    EQU        80                    ; max length for dec2str output 
  876.  
  877. decimal                    RECORD 0
  878. sgn                         ds.b    1                ; offset: $0 (0)        ;  sign 0 for +, 1 for - 
  879. unused                     ds.b    1                ; offset: $1 (1)
  880. exp                         ds.w    1                ; offset: $2 (2)        ;  decimal exponent 
  881. sig                         ds.b    SIGDIGLEN+2        ; offset: $4 (4)        ;  significant digits (pascal string)
  882. sizeof                     EQU *                    ; size:   $1A (26) or $2A (42)
  883.                         ENDR
  884.  
  885. decform                    RECORD 0
  886. style                     ds.b    1                ; offset: $0 (0)        ;  FLOATDECIMAL or FIXEDDECIMAL 
  887. unused                     ds.b    1                ; offset: $1 (1)
  888. digits                     ds.w    1                ; offset: $2 (2)
  889. sizeof                     EQU *                    ; size:   $4 (4)
  890.                         ENDR
  891. ;
  892. ; extern void num2dec(const decform *f, double_t x, decimal *d)
  893. ;
  894.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  895.         IMPORT_CFM_FUNCTION num2dec
  896.     ENDIF
  897.  
  898. ;
  899. ; extern double_t dec2num(const decimal *d)
  900. ;
  901.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  902.         IMPORT_CFM_FUNCTION dec2num
  903.     ENDIF
  904.  
  905. ;
  906. ; extern void dec2str(const decform *f, const decimal *d, char *s)
  907. ;
  908.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  909.         IMPORT_CFM_FUNCTION dec2str
  910.     ENDIF
  911.  
  912. ;
  913. ; extern void str2dec(const char *s, short *ix, decimal *d, short *vp)
  914. ;
  915.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  916.         IMPORT_CFM_FUNCTION str2dec
  917.     ENDIF
  918.  
  919.     IF TARGET_CPU_68K THEN
  920. ;
  921. ; extern double dec2d(const decimal *d)
  922. ;
  923.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  924.         IMPORT_CFM_FUNCTION dec2d
  925.     ENDIF
  926.  
  927.     ENDIF    ; TARGET_CPU_68K
  928. ;
  929. ; extern float dec2f(const decimal *d)
  930. ;
  931.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  932.         IMPORT_CFM_FUNCTION dec2f
  933.     ENDIF
  934.  
  935. ;
  936. ; extern short dec2s(const decimal *d)
  937. ;
  938.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  939.         IMPORT_CFM_FUNCTION dec2s
  940.     ENDIF
  941.  
  942. ;
  943. ; extern long dec2l(const decimal *d)
  944. ;
  945.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  946.         IMPORT_CFM_FUNCTION dec2l
  947.     ENDIF
  948.  
  949.  
  950.  
  951.  
  952. ; ********************************************************************************
  953. ;*                                                                                 *
  954. ;*                         68k-only Transfer Function Prototypes                 *
  955. ;*                                                                                 *
  956. ;*******************************************************************************
  957.  
  958.     IF TARGET_CPU_68K THEN
  959.     IF TARGET_RT_MAC_68881 THEN
  960. ;
  961. ; extern void x96tox80(const extended96 *x, extended80 *x80)
  962. ;
  963.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  964.         IMPORT_CFM_FUNCTION x96tox80
  965.     ENDIF
  966.  
  967. ;
  968. ; extern void x80tox96(const extended80 *x80, extended96 *x)
  969. ;
  970.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  971.         IMPORT_CFM_FUNCTION x80tox96
  972.     ENDIF
  973.  
  974.     ELSE
  975. ;
  976. ; extern void x96tox80(const extended96 *x96, extended80 *x)
  977. ;
  978.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  979.         IMPORT_CFM_FUNCTION x96tox80
  980.     ENDIF
  981.  
  982. ;
  983. ; extern void x80tox96(const extended80 *x, extended96 *x96)
  984. ;
  985.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  986.         IMPORT_CFM_FUNCTION x80tox96
  987.     ENDIF
  988.  
  989.     ENDIF    ; TARGET_RT_MAC_68881
  990.     ENDIF    ; TARGET_CPU_68K
  991.     ENDIF
  992. ; ********************************************************************************
  993. ;*                                                                                 *
  994. ;*                         PowerPC-only Function Prototypes                         *
  995. ;*                                                                                 *
  996. ;*******************************************************************************
  997.  
  998.  
  999.     IF TARGET_CPU_PPC THEN
  1000. ;
  1001. ; extern long double cosl(long double x)
  1002. ;
  1003.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1004.         IMPORT_CFM_FUNCTION cosl
  1005.     ENDIF
  1006.  
  1007. ;
  1008. ; extern long double sinl(long double x)
  1009. ;
  1010.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1011.         IMPORT_CFM_FUNCTION sinl
  1012.     ENDIF
  1013.  
  1014. ;
  1015. ; extern long double tanl(long double x)
  1016. ;
  1017.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1018.         IMPORT_CFM_FUNCTION tanl
  1019.     ENDIF
  1020.  
  1021. ;
  1022. ; extern long double acosl(long double x)
  1023. ;
  1024.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1025.         IMPORT_CFM_FUNCTION acosl
  1026.     ENDIF
  1027.  
  1028. ;
  1029. ; extern long double asinl(long double x)
  1030. ;
  1031.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1032.         IMPORT_CFM_FUNCTION asinl
  1033.     ENDIF
  1034.  
  1035. ;
  1036. ; extern long double atanl(long double x)
  1037. ;
  1038.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1039.         IMPORT_CFM_FUNCTION atanl
  1040.     ENDIF
  1041.  
  1042. ;
  1043. ; extern long double atan2l(long double y, long double x)
  1044. ;
  1045.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1046.         IMPORT_CFM_FUNCTION atan2l
  1047.     ENDIF
  1048.  
  1049. ;
  1050. ; extern long double coshl(long double x)
  1051. ;
  1052.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1053.         IMPORT_CFM_FUNCTION coshl
  1054.     ENDIF
  1055.  
  1056. ;
  1057. ; extern long double sinhl(long double x)
  1058. ;
  1059.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1060.         IMPORT_CFM_FUNCTION sinhl
  1061.     ENDIF
  1062.  
  1063. ;
  1064. ; extern long double tanhl(long double x)
  1065. ;
  1066.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1067.         IMPORT_CFM_FUNCTION tanhl
  1068.     ENDIF
  1069.  
  1070. ;
  1071. ; extern long double acoshl(long double x)
  1072. ;
  1073.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1074.         IMPORT_CFM_FUNCTION acoshl
  1075.     ENDIF
  1076.  
  1077. ;
  1078. ; extern long double asinhl(long double x)
  1079. ;
  1080.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1081.         IMPORT_CFM_FUNCTION asinhl
  1082.     ENDIF
  1083.  
  1084. ;
  1085. ; extern long double atanhl(long double x)
  1086. ;
  1087.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1088.         IMPORT_CFM_FUNCTION atanhl
  1089.     ENDIF
  1090.  
  1091. ;
  1092. ; extern long double expl(long double x)
  1093. ;
  1094.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1095.         IMPORT_CFM_FUNCTION expl
  1096.     ENDIF
  1097.  
  1098. ;
  1099. ; extern long double expm1l(long double x)
  1100. ;
  1101.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1102.         IMPORT_CFM_FUNCTION expm1l
  1103.     ENDIF
  1104.  
  1105. ;
  1106. ; extern long double exp2l(long double x)
  1107. ;
  1108.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1109.         IMPORT_CFM_FUNCTION exp2l
  1110.     ENDIF
  1111.  
  1112. ;
  1113. ; extern long double frexpl(long double x, int *exponent)
  1114. ;
  1115.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1116.         IMPORT_CFM_FUNCTION frexpl
  1117.     ENDIF
  1118.  
  1119. ;
  1120. ; extern long double ldexpl(long double x, int n)
  1121. ;
  1122.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1123.         IMPORT_CFM_FUNCTION ldexpl
  1124.     ENDIF
  1125.  
  1126. ;
  1127. ; extern long double logl(long double x)
  1128. ;
  1129.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1130.         IMPORT_CFM_FUNCTION logl
  1131.     ENDIF
  1132.  
  1133. ;
  1134. ; extern long double log1pl(long double x)
  1135. ;
  1136.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1137.         IMPORT_CFM_FUNCTION log1pl
  1138.     ENDIF
  1139.  
  1140. ;
  1141. ; extern long double log10l(long double x)
  1142. ;
  1143.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1144.         IMPORT_CFM_FUNCTION log10l
  1145.     ENDIF
  1146.  
  1147. ;
  1148. ; extern long double log2l(long double x)
  1149. ;
  1150.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1151.         IMPORT_CFM_FUNCTION log2l
  1152.     ENDIF
  1153.  
  1154. ;
  1155. ; extern long double logbl(long double x)
  1156. ;
  1157.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1158.         IMPORT_CFM_FUNCTION logbl
  1159.     ENDIF
  1160.  
  1161. ;
  1162. ; extern long double scalbl(long double x, long n)
  1163. ;
  1164.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1165.         IMPORT_CFM_FUNCTION scalbl
  1166.     ENDIF
  1167.  
  1168. ;
  1169. ; extern long double fabsl(long double x)
  1170. ;
  1171.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1172.         IMPORT_CFM_FUNCTION fabsl
  1173.     ENDIF
  1174.  
  1175. ;
  1176. ; extern long double hypotl(long double x, long double y)
  1177. ;
  1178.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1179.         IMPORT_CFM_FUNCTION hypotl
  1180.     ENDIF
  1181.  
  1182. ;
  1183. ; extern long double powl(long double x, long double y)
  1184. ;
  1185.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1186.         IMPORT_CFM_FUNCTION powl
  1187.     ENDIF
  1188.  
  1189. ;
  1190. ; extern long double sqrtl(long double x)
  1191. ;
  1192.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1193.         IMPORT_CFM_FUNCTION sqrtl
  1194.     ENDIF
  1195.  
  1196. ;
  1197. ; extern long double erfl(long double x)
  1198. ;
  1199.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1200.         IMPORT_CFM_FUNCTION erfl
  1201.     ENDIF
  1202.  
  1203. ;
  1204. ; extern long double erfcl(long double x)
  1205. ;
  1206.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1207.         IMPORT_CFM_FUNCTION erfcl
  1208.     ENDIF
  1209.  
  1210. ;
  1211. ; extern long double gammal(long double x)
  1212. ;
  1213.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1214.         IMPORT_CFM_FUNCTION gammal
  1215.     ENDIF
  1216.  
  1217. ;
  1218. ; extern long double lgammal(long double x)
  1219. ;
  1220.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1221.         IMPORT_CFM_FUNCTION lgammal
  1222.     ENDIF
  1223.  
  1224. ;
  1225. ; extern long double ceill(long double x)
  1226. ;
  1227.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1228.         IMPORT_CFM_FUNCTION ceill
  1229.     ENDIF
  1230.  
  1231. ;
  1232. ; extern long double floorl(long double x)
  1233. ;
  1234.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1235.         IMPORT_CFM_FUNCTION floorl
  1236.     ENDIF
  1237.  
  1238. ;
  1239. ; extern long double rintl(long double x)
  1240. ;
  1241.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1242.         IMPORT_CFM_FUNCTION rintl
  1243.     ENDIF
  1244.  
  1245. ;
  1246. ; extern long double nearbyintl(long double x)
  1247. ;
  1248.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1249.         IMPORT_CFM_FUNCTION nearbyintl
  1250.     ENDIF
  1251.  
  1252. ;
  1253. ; extern long rinttoll(long double x)
  1254. ;
  1255.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1256.         IMPORT_CFM_FUNCTION rinttoll
  1257.     ENDIF
  1258.  
  1259. ;
  1260. ; extern long double roundl(long double x)
  1261. ;
  1262.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1263.         IMPORT_CFM_FUNCTION roundl
  1264.     ENDIF
  1265.  
  1266. ;
  1267. ; extern long roundtoll(long double round)
  1268. ;
  1269.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1270.         IMPORT_CFM_FUNCTION roundtoll
  1271.     ENDIF
  1272.  
  1273. ;
  1274. ; extern long double truncl(long double x)
  1275. ;
  1276.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1277.         IMPORT_CFM_FUNCTION truncl
  1278.     ENDIF
  1279.  
  1280. ;
  1281. ; extern long double remainderl(long double x, long double y)
  1282. ;
  1283.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1284.         IMPORT_CFM_FUNCTION remainderl
  1285.     ENDIF
  1286.  
  1287. ;
  1288. ; extern long double remquol(long double x, long double y, int *quo)
  1289. ;
  1290.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1291.         IMPORT_CFM_FUNCTION remquol
  1292.     ENDIF
  1293.  
  1294. ;
  1295. ; extern long double copysignl(long double x, long double y)
  1296. ;
  1297.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1298.         IMPORT_CFM_FUNCTION copysignl
  1299.     ENDIF
  1300.  
  1301. ;
  1302. ; extern long double fdiml(long double x, long double y)
  1303. ;
  1304.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1305.         IMPORT_CFM_FUNCTION fdiml
  1306.     ENDIF
  1307.  
  1308. ;
  1309. ; extern long double fmaxl(long double x, long double y)
  1310. ;
  1311.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1312.         IMPORT_CFM_FUNCTION fmaxl
  1313.     ENDIF
  1314.  
  1315. ;
  1316. ; extern long double fminl(long double x, long double y)
  1317. ;
  1318.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1319.         IMPORT_CFM_FUNCTION fminl
  1320.     ENDIF
  1321.  
  1322.  
  1323.     IF &TYPE('__NOEXTENSIONS__') = 'UNDEFINED' THEN
  1324. ;
  1325. ; extern relop relationl(long double x, long double y)
  1326. ;
  1327.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1328.         IMPORT_CFM_FUNCTION relationl
  1329.     ENDIF
  1330.  
  1331. ;
  1332. ; extern void num2decl(const decform *f, long double x, decimal *d)
  1333. ;
  1334.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1335.         IMPORT_CFM_FUNCTION num2decl
  1336.     ENDIF
  1337.  
  1338. ;
  1339. ; extern long double dec2numl(const decimal *d)
  1340. ;
  1341.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1342.         IMPORT_CFM_FUNCTION dec2numl
  1343.     ENDIF
  1344.  
  1345. ;     
  1346. ;    MathLib v2 has two new transfer functions: x80tod and dtox80.  They can 
  1347. ;    be used to directly transform 68k 80-bit extended data types to double
  1348. ;    and back for PowerPC based machines without using the functions
  1349. ;    x80told or ldtox80.  Double rounding may occur. 
  1350. ;
  1351.  
  1352. ;
  1353. ; extern void x80told(const extended80 *x80, long double *x)
  1354. ;
  1355.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1356.         IMPORT_CFM_FUNCTION x80told
  1357.     ENDIF
  1358.  
  1359. ;
  1360. ; extern void ldtox80(const long double *x, extended80 *x80)
  1361. ;
  1362.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1363.         IMPORT_CFM_FUNCTION ldtox80
  1364.     ENDIF
  1365.  
  1366. ;
  1367. ; extern double x80tod(const extended80 *x80)
  1368. ;
  1369.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1370.         IMPORT_CFM_FUNCTION x80tod
  1371.     ENDIF
  1372.  
  1373. ;
  1374. ; extern void dtox80(const double *x, extended80 *x80)
  1375. ;
  1376.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1377.         IMPORT_CFM_FUNCTION dtox80
  1378.     ENDIF
  1379.  
  1380.     ENDIF
  1381.     ENDIF    ; TARGET_CPU_PPC
  1382.     ELSE
  1383. ;    Non-Mac platforms may have long doubles.
  1384. ;
  1385.  
  1386. ;
  1387. ; extern void x80told(const extended80 *x80, long double *x)
  1388. ;
  1389.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1390.         IMPORT_CFM_FUNCTION x80told
  1391.     ENDIF
  1392.  
  1393. ;
  1394. ; extern void ldtox80(const long double *x, extended80 *x80)
  1395. ;
  1396.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1397.         IMPORT_CFM_FUNCTION ldtox80
  1398.     ENDIF
  1399.  
  1400.     ENDIF    ; TARGET_OS_MAC
  1401.     ENDIF ; __FP__ 
  1402.  
  1403.